<%--
@Created by IntelliJ IDEA
@Project_Name ieco_server
@Package 
@Author ZhongYao_H
@Date 2019/5/14:10:02
@Year 2019 Month 05 Day 14
@Date_zh  2019年 五月 星期二
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html>

<head>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/assets/hplus/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/hplus/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/hplus/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/hplus/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/hplus/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/assets/hplus/css/style.css?v=4.1.0" rel="stylesheet">

    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/assets/hplus/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
    <%@include file="/WEB-INF/common/hplus-js.jsp" %>
    <style>

        html,body{
            height: 100%;
            width: 100%;
        }

    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">

    <form  class="form-horizontal m-t" action="${pageContext.request.contextPath}/artificialreply/searchreply" id="form" method="post">
        <div class="form-group">
            <label class="col-sm-3 control-label">手机号：</label>
            <div class="col-sm-7">
                <input name="mobile"  id="m" value="${moblie}" required="required" aria-required="true" class="form-control" type="number" />
            </div>

        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">回复标题：</label>
            <div class="col-sm-7">
                <input name="title"  id="title" required="required" aria-required="true" class="form-control" type="text" />
            </div>

        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">回复内容：</label>
            <div class="col-sm-7">
                <input name="msg" id="msg" type="hidden"/>
                <div class="row" style="height: 50%">
                    <div class="col-sm-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>编辑内容</h5>
                                <button id="edit" class="btn btn-primary btn-xs m-l-sm"  type="button">编辑</button>
                                <button id="save" class="btn btn-primary  btn-xs"  type="button">保存</button>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>

                                </div>
                            </div>
                            <div class="ibox-content" id="eg">

                                <div id="main" class="click2edit wrapper">
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                    <br>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </form>

    <div class="form-group">
        <div class="col-sm-4 col-sm-offset-3" style="text-align: center;">
            <button class="btn btn-primary" id="add-btn" onclick="submit()" type="button">提交</button>
        </div>
    </div>

</div>



<!-- 全局js -->
<%--<script src="${pageContext.request.contextPath}/assets/hplus/js/jquery.min.js?v=2.1.4"></script>--%>
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/hplus/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/assets/hplus/js/content.js?v=1.0.0"></script>
<!-- SUMMERNOTE -->

<script src="${pageContext.request.contextPath}/assets/hplus/js/plugins/summernote/summernote.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/hplus/js/plugins/summernote/summernote-zh-CN.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        $('.summernote').summernote({
            lang: 'zh-CN'
        });
    });

    $("#edit").click(function () {
        $("#main").empty();
        $("#eg").addClass("no-padding");
        $('.click2edit').summernote({
            lang: 'zh-CN',
            focus: true
        });
    });

    function edit () {
    };

    $("#save").click(function () {
        $("#eg").removeClass("no-padding");
        var allHTML = $('.click2edit').code(); // 这是编辑好的源码 图片以base64编码存储
        console.log(allHTML)
        $("#msg").val(allHTML)

        $('.click2edit').destroy();
    });

     function save () {

    };



    function submit() {

         if ($("#title").val()=='' || $('#m').val()==''){
             layer.msg('填写信息不完整',{icon:5})
             return
         }

         if ($("#msg").val()=='' ){
             layer.msg('编辑好内容后要保存哦!',{icon:5})
             return
         }

             $("#form").ajaxSubmit({
                 dataType:'json',
                 type:"POST",
                 success:function (json) {
                     var code = json.code;
                     if (code==0){
                         layer.msg(json.msg,{icon:1})
                         setTimeout(function () {
                             parent.window.location.reload();
                         },1000)

                     }else {
                         layer.msg(json.msg,{icon:5})
                     }
                 }
             });

    }

</script>
<script>


</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
</body>
</html>
